package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsSMSSMSGensSalesPageUtil extends SeleniumPageUtil {
	public final static By RSGS_TD_CUSTOMER = By.id("ctl44_lblCustomer");
	public final static By RSGS_INPUT_CUSTOMER = By.id("ctl44_txtCustomer");
	public final static By RSGS_TD_DATE_RANGE = By.id("ctl44_lblDateRange");
	public final static By RSGS_INPUT_START_DATE = By.id("ctl44_dteStartDate_txtDatePart");
	public final static By RSGS_IMG_START_DATE = By.id("ctl44_dteStartDate_imgDateCalendar");
	public final static By RSGS_INPUT_END_DATE = By.id("ctl44_dteEndDate_txtDatePart");
	public final static By RSGS_IMG_END_DATE = By.id("ctl44_dteEndDate_imgDateCalendar");
	public final static By RSGS_BUTTON_SUBMIT = By.id("ctl44_btnDateRange");
	public final static By RSGS_SPAN_HEADER = By.id("ctl44_Report_Header_lblHeader");
	public final static By RSGS_IMG_PREFERENCE = By.id("ctl44_Report_Header_imgPreferences");
	public final static By RSGS_IMG_EXPORT = By.id("ctl44_Report_Header_imgExcelExport");
	public final static By RSGS_TD_SPAN = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr/td[1]");
	public final static By RSGS_SPAN_PAGE_NO = By.id("ctl44_Report_PagingTop_lblPagingPageNumber");
	public final static By RSGS_TD_OF = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[4]/tbody/tr/td[3]");
	public final static By RSGS_TD_PAGE_COUNT = By.id("ctl44_Report_PagingTop_lblPagingPageCount");
	public final static By RSGS_IMG_FIRST = By.id("ctl44_Report_PagingTop_imgFirst");
	public final static By RSGS_IMG_PREVIOUS = By.id("ctl44_Report_PagingTop_imgPrevious");
	public final static By RSGS_IMG_NEXT = By.id("ctl44_Report_PagingTop_imgNext");
	public final static By RSGS_IMG_LAST = By.id("ctl44_Report_PagingTop_imgLast");
	public final static By RSGS_IMG_FILTER_1 = By.id("ctl44_Report_filter_1");
	public final static By RSGS_IMG_FILTER_2 = By.id("ctl44_Report_filter_2");
	public final static By RSGS_IMG_FILTER_3 = By.id("ctl44_Report_filter_3");
	public final static By RSGS_IMG_FILTER_4 = By.id("ctl44_Report_filter_4");
	public final static By RSGS_IMG_FILTER_5 = By.id("ctl44_Report_filter_5");
	public final static By RSGS_IMG_FILTER_6 = By.id("ctl44_Report_filter_6");
	public final static By RSGS_IMG_FILTER_7 = By.id("ctl44_Report_filter_7");
	public final static By RSGS_IMG_FILTER_8 = By.id("ctl44_Report_filter_8");
	public final static By RSGS_IMG_FILTER_9 = By.id("ctl44_Report_filter_9");
	public final static By RSGS_IMG_FILTER_10 = By.id("ctl44_Report_filter_10");
	public final static By RSGS_IMG_FILTER_11 = By.id("ctl44_Report_filter_11");
	public final static By RSGS_TH_CONTRACT_ID = By.id("ctl44_Report_sort_1");
	public final static By RSGS_TH_LINE = By.id("ctl44_Report_sort_2");
	public final static By RSGS_TH_SRO_ID = By.id("ctl44_Report_sort_3");
	public final static By RSGS_TH_SERIAL_NUMBER = By.id("ctl44_Report_sort_4");
	public final static By RSGS_TH_MFG_NAME = By.id("ctl44_Report_sort_5");
	public final static By RSGS_TH_MODEL = By.id("ctl44_Report_sort_6");
	public final static By RSGS_TH_ASSET = By.id("ctl44_Report_sort_7");
	public final static By RSGS_TH_DESCRIPTION = By.id("ctl44_Report_sort_8");
	public final static By RSGS_TH_ADDRESS = By.id("ctl44_Report_sort_9");
	public final static By RSGS_TH_CREATE_DATE = By.id("ctl44_Report_sort_10");
	public final static By RSGS_TH_CREATE_BY = By.id("ctl44_Report_sort_11");
	
	public static void enterReportsSMSSMSGensSalesPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_SITE_AUDITS_SMS_GENS_SALES));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RSGS_IMG_EXPORT, RSGS_BUTTON_SUBMIT, RSGS_IMG_FILTER_11, RSGS_TH_CREATE_BY
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSGS_IMG_EXPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSGS_BUTTON_SUBMIT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSGS_IMG_FILTER_11));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSGS_TH_CREATE_BY));
	}
}
